<template>
  <view class="page-container">
    <view class="h-250 bg-87 flex justify-between items-end px-50 pb-24 text-ff">
    <view>
      <view class="font-bold font-30 mb-24">预测分数</view>
      <view><text class="font-92">0</text>分</view>
    </view>
      <view>
        <image class="rounded-full w-130 h-130 head" :src="utils.avatar(useStore.userInfo.avatarUrl)" />
        <view class="text-center">{{ useStore.userInfo.nickName? useStore.userInfo.nickName : '--' }}</view>
      </view>
    </view>
    <view class="flex justify-between items-center mb-24 mt-50">
      <view class="w-200 text-center">
        <view><text class="font-bold font-36">0</text>次</view>
        <view class="mt-10 text-77">累计考试</view>
      </view>
      <view class="w-200 text-center">
        <view><text class="font-bold font-36">0</text>次</view>
        <view class="mt-10 text-77">及格次数</view>
      </view>
    </view>
    <view class="flex items-center">
      <view class="h-2 bg-dd flex-1"></view>
      <view class="mx-24">历史数据</view>
      <view class="h-2 bg-dd flex-1"></view>
    </view>
    <scroll-view scroll-y="true" class="page-body py-20 ">
      <up-empty marginTop="100" text="暂无数据" ></up-empty>
    </scroll-view>
  </view>
</template>
<script setup>
import { ref} from 'vue'
import {onLoad} from "@dcloudio/uni-app"
import utils from '@/utils/utils.js'
import {subject} from '@/api'
import useUserStore from '@/store/user.js'
const useStore = useUserStore()
const resData = ref({})
const loading = ref(false)
onLoad((options) => {
  if(options.categoryId) {
    uni.showLoading({title: '加载中'})
    subject.getSubjectHistory({uid: useStore.uid, cateid: options.categoryId,passf:100}).then(res => {
      if (res.code === 0) {
        resData.value = res.data
        console.log('resData', resData.value)
      }
    }).catch(error => {
      console.log('error', error)
    }).finally(() => {
      loading.value = true
      uni.hideLoading()
    })
  }
})
</script>
<style scoped lang="scss">
.head{
  border: 6rpx #ffffff solid;
}
</style>